home *** CD-ROM | disk | FTP | other *** search
/ Biodiversity of Illinois 2: Woodland Habitats / Biodiversity of Illinois 2 - Woodland Habitats.iso / mac / casts / PDFxtraBehaviors.cst / 00013_Script_PDF_SetDisplayMode < prev    next >
Text File  |  2006-07-11  |  4KB  |  103 lines

  1. -- Set Display Mode
  2.  
  3. Property pEvent, pSprite, pMode, pAlertFlag
  4.  
  5. on doSetDisplay me
  6.   case pMode of:
  7.     "Pages Only": set m = #pagesOnly
  8.     "Bookmarks and Pages": set m = #bookmarkAndPages
  9.     "Thumbnails and Pages": set m = #thumbnailAndPages
  10.   end case
  11.   set err = PDF_SetDisplayMode(sprite pSprite, m)
  12.   if PDF_status(sprite pSprite) then alert "PDF Behavior Error"&RETURN&PDF_error(sprite pSprite)
  13. end doSetDisplay
  14.  
  15. on mouseUp me
  16.   if (pEvent = #mouseUp) then doSetDisplay(me)
  17. end mouseUp
  18.  
  19. on mouseDown me
  20.   if (pEvent = #mouseDown) then doSetDisplay(me)
  21. end mouseDown
  22.  
  23. on prepareFrame me
  24.   if (pEvent = #prepareFrame) then doSetDisplay(me)
  25. end prepareFrame
  26.  
  27. -- standard behavior stuff --
  28. on getPropertyDescriptionList me
  29.   set defaultValues = GetDefaultValues (me)
  30.   
  31.   set pdfSpriteList = getProp (defaultValues, #spriteList)
  32.   set defSprite     = getProp (defaultValues, #defaultSprite)
  33.   if (defSprite=0) then 
  34.     if the ticks - pAlertFlag > 10 then
  35.       alert "Please create a sprite of type PDF first."
  36.     end if
  37.     set pAlertFlag = the ticks -- The ticks when the user clicked "OK"
  38.     
  39.     exit
  40.   end if
  41.   set p_list = [:]
  42.   addprop p_list, #pEvent, [ #comment: "Event", #format:#symbol, #range:[#mouseUp, #mouseDown, #prepareFrame], #default:#mouseUp]
  43.   addprop p_list, #pSprite, [ #comment: "PDF Sprite is in channel:", #format:#symbol, #range:pdfSpriteList, #default:defSprite]
  44.   addprop p_list, #pMode, [ #comment: "Display mode:", #format:#symbol, #range:["Pages Only", "Bookmarks and Pages", "Thumbnails and Pages"], #default:"Pages Only"]
  45.   return p_list
  46. end
  47.  
  48. on getBehaviorDescription
  49.   tmp = "Switch Acrobat's/Reader's display mode to Pages Only, Bookmarks+Pages or Thumbnails+Pages" 
  50.   tmp = tmp &RETURN& "Available for Windows only, Acrobat or Reader." 
  51.   tmp = tmp &RETURN&RETURN& "--- PARAMETERS ---"
  52.   tmp = tmp &RETURN& " - Event: mouseUp, mouseDown, or prepareFrame"
  53.   tmp = tmp &RETURN& " - Sprite is in channel: which channel contains the PDF Sprite"
  54.   tmp = tmp & RETURN& " - Display mode: Pages Only, Bookmark And Pages, or Thumbnail And Pages"
  55.   tmp = tmp &RETURN&RETURN& "Free to use and abuse. (c)1999, Integration New Media, Inc."  &RETURN& "Thanks to James Newton for his suggestions"
  56.   return tmp  
  57. end
  58.  
  59. on getBehaviorTooltip
  60.   return "Switch Acrobat's/Reader's display mode to Pages Only,"&RETURN&  "Bookmarks+Pages or Thumbnails+Pages" &RETURN& "Available for Windows only, Acrobat or Reader."
  61. end
  62.  
  63. -- utils --
  64. on GetDefaultValues me
  65.   if the currentSpriteNum then
  66.     set spriteList = GetSpriteList (me #PDF)
  67.     if count (spriteList) then
  68.       set defaultSprite = getAt (spriteList, 1)
  69.     else
  70.       set defaultSprite = 0
  71.     end if
  72.     
  73.     return [#spriteList: spriteList, #defaultSprite: defaultSprite]
  74.     
  75.   else -- the currentSpriteNum = 0
  76.     -- Director is merely recompiling this script: return dummy values
  77.     return [#spriteList: [1], #defaultSprite: 1]
  78.   end if
  79. end 
  80.  
  81.  
  82. on GetSpriteList me, memberType
  83.   -- return list of sprites of type memberType in current frame
  84.   global version
  85.   if (char 1 of version = 6) then
  86.     set maxSprite = 120
  87.   else
  88.     set maxSprite = the lastChannel
  89.   end if
  90.   
  91.   set aList=[]
  92.   
  93.   repeat with i = 1 to maxSprite
  94.     set spriteMember = the member of sprite i
  95.     -- if (string(m) contains "member 0") then next repeat -- unnecessary
  96.     if (the type of spriteMember = memberType) then -- (JN) Line break
  97.       append (aList, i)
  98.     end if
  99.   end repeat
  100.   
  101.   return aList
  102. end GetSpriteList
  103.